package com.ynwa.maths.sort;

import java.util.Arrays;

/**
 * 选择排序
 *
 * @author gzd
 * @date 2019-10-27 15:38
 */
public class SelectSort {

    public static void main(String[] args) {
        Integer[] integers = {1, 9, 2, 3, 8, 6, 7};
        for (int i = 0; i < integers.length; i++) {
            for (int j = i + 1; j < integers.length; j++) {
                if (integers[j] < integers[i]){
                    int swap = integers[j];
                    integers[j] = integers[i];
                    integers[i] = swap;
                }
            }
        }
        System.out.println(Arrays.toString(integers));
    }
}
